
#pragma once


namespace __OCF_STUB__ 
{


using namespace __OCF_BASE__;




template <class IF>
class CUserToLogin
{
	typedef TYPE_LIST09(BYTE,BYTE*,DWORD,DWORD*,USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnCheckAuth__ = 1,

		__END__
	};
	typedef IF _N_IF_T;
	typedef long (CUserToLogin<_N_IF_T>::*_FUNC_T)(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn);

public:
	CUserToLogin(_N_IF_T* pcIf = NULL)
		:m_pcIf(pcIf)
	{
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
		m_pCurrRcvBuff = NULL;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
#endif
		m_ulBindX = 0;
		m_ulIdentity = 0;

	}
	virtual ~CUserToLogin()
	{
	}
	CUserToLogin& operator =(const CUserToLogin& cFrom)
	{
		m_pcIf = cFrom.m_pcIf;
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
		m_pCurrRcvBuff = cFrom.m_pCurrRcvBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
#endif
		m_ulBindX = cFrom.m_ulBindX;
		m_ulIdentity = cFrom.m_ulIdentity;

		return *this;
	}
	long StubDispatch()
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cIn(m_ulLenRcvBuff, m_pRcvBuff);
		USHORT uiCmd;

		if (FALSE == cIn.Pop(uiCmd).IsValid())
		{
			return -3;
		}
		if (uiCmd >= __END__)
		{
			return -4;
		}
		if (NULL == m_apcFunc[uiCmd])
		{
			return -5;
		}

		long lRet = (this->*m_apcFunc[uiCmd])(cIn);
		if (0 <= lRet)
		{
			m_pCurrRcvBuff = cIn.GetCurrDataPtr();
		}

		return lRet; 
	}

public:
	inline void SetIf(_N_IF_T* pcIf) { m_pcIf = pcIf; }

#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff, ULONG ulLenSndBuff = 0, void* pSndBuff = NULL) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_pCurrRcvBuff = pRcvBuff; m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }

	inline ULONG GetLengthRcvBuff() { return m_ulLenRcvBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline void* GetRcvBuff() { return m_pRcvBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
	inline void* GetCurrRcvBuff() { return m_pCurrRcvBuff; }
#else
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_pCurrRcvBuff = pRcvBuff; }

	inline ULONG GetLengthSndBuff() { return m_ulLenRcvBuff; }
	inline void* GetSndBuff() { return m_pRcvBuff; }
	inline void* GetCurrRcvBuff() { return m_pCurrRcvBuff; }
#endif
private:
	inline ULONG GetBindX() { return m_ulBindX; }
	inline ULONG GetIdentity() { return m_ulIdentity; }
private:
	long fnCheckAuth(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		ULONG nLenLocalIP;char * pszLocalIP;DWORD dwUserSn;ULONG nLenAuthKey;char * pszAuthKey;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(nLenLocalIP,(const char ** )(&pszLocalIP)).Pop(dwUserSn).Pop(nLenAuthKey,(const char ** )(&pszAuthKey)).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnCheckAuth(GetBindX(),GetIdentity(),(int )nLenLocalIP,pszLocalIP,dwUserSn,(int )nLenAuthKey,pszAuthKey);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
		//long fnCheckAuth(ULONG ulBIndX,ULONG ulIdentity,ULONG nLenLocalIP,char * pszLocalIP,DWORD dwUserSn,ULONG nLenAuthKey,char * pszAuthKey) { return 1; }
	}

private:
	static _FUNC_T m_apcFunc[__END__];
	_N_IF_T* m_pcIf;
	ULONG m_ulLenRcvBuff;
	const void* m_pRcvBuff;
	const void* m_pCurrRcvBuff;
	ULONG m_ulLenSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	void* m_pSndBuff;
#endif
	ULONG m_ulBindX;
	ULONG m_ulIdentity;
};

template <class IF>
typename CUserToLogin<IF>::_FUNC_T CUserToLogin<IF>::m_apcFunc[__END__] = {
	NULL,
	&CUserToLogin<IF>::fnCheckAuth,
};


#undef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__


template <class IF>
class CLoginToUser
{
	typedef TYPE_LIST09(BYTE,BYTE*,DWORD,DWORD*,USHORT,char,char*,int,int*) _OCF_PROXYSTUB_TYPELIST_T;
	enum __ENUM_PROXYSTUB_FUNCTION_TYPE__
	{
		__ENUM_FUNCTION_TYPE_fnResultCheckAuth__ = 101,

		__END__
	};
	typedef IF _N_IF_T;
	typedef long (CLoginToUser<_N_IF_T>::*_FUNC_T)(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn);

public:
	CLoginToUser(_N_IF_T* pcIf = NULL)
		:m_pcIf(pcIf)
	{
		m_ulLenRcvBuff = 0;
		m_pRcvBuff = NULL;
		m_pCurrRcvBuff = NULL;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenSndBuff = 0;
		m_pSndBuff = NULL;
#endif
		m_ulBindX = 0;
		m_ulIdentity = 0;

	}
	virtual ~CLoginToUser()
	{
	}
	CLoginToUser& operator =(const CLoginToUser& cFrom)
	{
		m_pcIf = cFrom.m_pcIf;
		m_ulLenRcvBuff = cFrom.m_ulLenRcvBuff;
		m_pRcvBuff = cFrom.m_pRcvBuff;
		m_pCurrRcvBuff = cFrom.m_pCurrRcvBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
		m_ulLenSndBuff = cFrom.m_ulLenSndBuff;
		m_pSndBuff = cFrom.m_pSndBuff;
#endif
		m_ulBindX = cFrom.m_ulBindX;
		m_ulIdentity = cFrom.m_ulIdentity;

		return *this;
	}
	long StubDispatch()
	{
		CIn<_OCF_PROXYSTUB_TYPELIST_T> cIn(m_ulLenRcvBuff, m_pRcvBuff);
		USHORT uiCmd;

		if (FALSE == cIn.Pop(uiCmd).IsValid())
		{
			return -3;
		}
		if (uiCmd >= __END__)
		{
			return -4;
		}
		if (NULL == m_apcFunc[uiCmd])
		{
			return -5;
		}

		long lRet = (this->*m_apcFunc[uiCmd])(cIn);
		if (0 <= lRet)
		{
			m_pCurrRcvBuff = cIn.GetCurrDataPtr();
		}

		return lRet; 
	}

public:
	inline void SetIf(_N_IF_T* pcIf) { m_pcIf = pcIf; }

#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff, ULONG ulLenSndBuff = 0, void* pSndBuff = NULL) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_pCurrRcvBuff = pRcvBuff; m_ulLenSndBuff = ulLenSndBuff; m_pSndBuff = pSndBuff; }

	inline ULONG GetLengthRcvBuff() { return m_ulLenRcvBuff; }
	inline ULONG GetLengthSndBuff() { return m_ulLenSndBuff; }
	inline void* GetRcvBuff() { return m_pRcvBuff; }
	inline void* GetSndBuff() { return m_pSndBuff; }
	inline void* GetCurrRcvBuff() { return m_pCurrRcvBuff; }
#else
	inline void SetStubInfo(ULONG ulBindX, ULONG ulIdentity, ULONG ulLenRcvBuff, const void* pRcvBuff) { m_ulBindX = ulBindX; m_ulIdentity = ulIdentity; m_ulLenRcvBuff = ulLenRcvBuff; m_pRcvBuff = pRcvBuff; m_pCurrRcvBuff = pRcvBuff; }

	inline ULONG GetLengthSndBuff() { return m_ulLenRcvBuff; }
	inline void* GetSndBuff() { return m_pRcvBuff; }
	inline void* GetCurrRcvBuff() { return m_pCurrRcvBuff; }
#endif
private:
	inline ULONG GetBindX() { return m_ulBindX; }
	inline ULONG GetIdentity() { return m_ulIdentity; }
private:
	long fnResultCheckAuth(CIn<_OCF_PROXYSTUB_TYPELIST_T>& cIn_A3C01056_FD2D_4800_912C_69683F47B599_)
	{
		ULONG nLenUserID;char * pszUserID;BYTE byRes;
		if (FALSE == cIn_A3C01056_FD2D_4800_912C_69683F47B599_.Pop(nLenUserID,(const char ** )(&pszUserID)).Pop(byRes).IsValid()) return -1;
		long _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_ = m_pcIf->fnResultCheckAuth(GetBindX(),GetIdentity(),(int )nLenUserID,pszUserID,byRes);
		return _lRet742173F4_8580_42ce_BF4E_4828036EB6A6_;
		//long fnResultCheckAuth(ULONG ulBIndX,ULONG ulIdentity,ULONG nLenUserID,char * pszUserID,BYTE byRes) { return 1; }
	}

private:
	static _FUNC_T m_apcFunc[__END__];
	_N_IF_T* m_pcIf;
	ULONG m_ulLenRcvBuff;
	const void* m_pRcvBuff;
	const void* m_pCurrRcvBuff;
	ULONG m_ulLenSndBuff;
#ifdef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
	void* m_pSndBuff;
#endif
	ULONG m_ulBindX;
	ULONG m_ulIdentity;
};

template <class IF>
typename CLoginToUser<IF>::_FUNC_T CLoginToUser<IF>::m_apcFunc[__END__] = {
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	NULL,
	&CLoginToUser<IF>::fnResultCheckAuth,
};


#undef __SYNC_CALL_7C82602D_4E46_47a6_BFDD_AD8D42FA3FCD__
}
